const fs = require("fs");

const reg = /\/file\/(.*)/;

function getFile(req,res) {
  /* 处理静态资源 /file/imgs/fuckoff.jpg */
  const filePath = reg.exec(req.url)[1];
  const data = fs.readFileSync(`./public/${filePath}`);
  res.end(data);
}

module.exports = {
    getFile
}
